<?php
/**
 * Created by PhpStorm.
 * User: u
 * Date: 2018/12/11
 * Time: 13:52
 */
namespace common\logics\category;

use common\widgets\Tool;
use Yii;
use yii\base\BaseObject;

class CategoryLogic extends BaseObject implements ICategory
{
    /** @var \common\sources\read\category\CategoryAccess $RCategoryAccess ***/
    private $RCategoryAccess;

    public function init()
    {
        $this->RCategoryAccess = Yii::$container->get("RCategoryAccess");
        parent::init();
    }

    public function getList($data)
    {
        if(!is_numeric($data['cid'])){
            return Tool::returnJson([],401,"类别id不能为空");
        }
        $list = $this->RCategoryAccess->getCategory($data['cid']);
        return Tool::returnJson($list,200,"成功");
    }
}